<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Rx学习</title>
</head>
<body>
<h4>我们做一个简单的BMI 公式</h4>
weight:
<input type="number" id="weight">kg
<br>
height:
<input type="number" id="height"> cm
<br>
Your BMI is
<div id="bmi"></div>

</body>
<!--<script src="https://code.jquery.com/jquery-3.1.0.js"></script>-->
<script src="https://cdn.bootcss.com/rxjs/6.0.0-alpha.3/Rx.min.js"></script>
<script>
    const ob1 = Rx.Observable.ajax('http://localhost:3000/user/list');
    const ob2 = Rx.Observable.ajax('http://localhost:3000/user/1');
    const obs = [ob1, ob2];
    //N个请求按顺序串行发出（前一个结束再发下一个）
    Rx.Observable.concat(...obs).subscribe(detail => console.log(detail,'==>concat每个请求都触发回调'));
    //N个请求同时并行发出，对于每一个到达就触发一次回调
    Rx.Observable.merge(...obs).subscribe(detail => console.log(detail,'==>merge每个请求都触发回调'));
    //N个请求同时发出并且要求全部到达后合并为数组，触发一次回调
    Rx.Observable.forkJoin(...obs).subscribe(detailArray => console.log(detailArray,'==>forkJoin触发一次回调'));
</script>
</html>